<h2>修改密码</h2>
<?php 
if(isset($_GET['ok'])) {if($_GET['ok']==0) $mess='修改密码成功!请用新密码重新登录!'; unset($_GET['ok']);}
$cs=Yii::app()->clientScript;
$cs->registerScript('edit_pass_form',<<<END
var check1;
function check(){
	if(!$("#ejsvformid1").valid()) return false;
	$.ajax({'type':'POST','url':'?r=users/checkOldPass','async':false,'cache':false,'data':'pass='+$("#Users_oldpassword").val(),'success':function(data){check1=data;}});
	if(check1!=1) {alert("原始密码不正确!");return false;}
	return true;
}
$('form').submit(check);
END
);
?>
<div class="yiiForm">
<?php
	echo EHtml::form();	
	EHtml::setOptions(array('errorElement'=> 'span'));
	EHtml::setScenario('password');				  		
?>
<div>注：<span class="required">*</span>为必填项</div>
<div id="one1">
<div class="simple">
<?php echo CHtml::activeLabel($model,'username'); ?>
<?php echo $model->username;?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabel($model,'true_name'); ?>
<?php echo $model->true_name;?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'oldpassword'); ?>
<?php echo EHtml::activePasswordField($model,'oldpassword',array('size'=>16,'maxlength'=>16)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'password'); ?>
<?php echo EHtml::activePasswordField($model,'password',array('size'=>16,'maxlength'=>16)); ?>
</div>
<div class="simple" style="border-bottom:1px solid #90b3bc;">
<?php echo CHtml::activeLabelEx($model,'repassword'); ?>
<?php echo EHtml::activePasswordField($model,'repassword',array('size'=>16,'maxlength'=>16)); ?>
</div>
</div>


<div class="action">
<?php echo EHtml::submitButton('更新密码'); ?>
</div>

<?php echo EHtml::endForm(); ?>

</div><!-- yiiForm -->
<?php 
if(isset($mess)) echo "<script>alert('$mess');</script>";
if($model->hasErrors()) echo "<script>alert('您填写的信息有误！请根据页面红色图标提示修改。');</script>";
?>